/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.lizg.util;

import app.Main;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Administrator
 */
public class UiUtil {
    private UiUtil(){}
    public static void setFrameImage(JFrame jf){
        Toolkit tk=Toolkit.getDefaultToolkit();
        Image i=tk.getImage("src\\cn\\lizg\\util\\favicon.jpg");
        jf.setIconImage(i);
    }
    public static void setFrameCenter(JFrame jf){
        Toolkit tk=Toolkit.getDefaultToolkit();
        Dimension d=tk.getScreenSize();
        int width=(int)(d.getWidth()-jf.getWidth())/2;
        int height=(int)(d.getHeight()-jf.getWidth())/2;
        jf.setLocation(width, height);
    }
    public static void setFrameappearence(){
        try {
        UIManager.setLookAndFeel(MyLookAndFeel.JTATTOO_MCWIN);
        } catch (ClassNotFoundException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
